﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KCLIMTrading.Mgmt
{
  public class Item
  {
    #region Variable
    private int quantity;
    private decimal price;
    #endregion

    #region Properties
    private String unitOfMeasure;
    /// <summary>
    /// Set or get product unit or measure
    /// </summary>
    public String UnitOfMeasure { get {return this.unitOfMeasure;} set {this.unitOfMeasure = value;} }
    /// <summary>
    /// Gets or sets order quantity.
    /// </summary>
    public int Quantity { get { return this.quantity; } set { this.quantity = value; } }
    /// <summary>
    /// Gets net value of items.
    /// </summary>
    public decimal NetValue
    {
      get
      {
        this.price = this.product.Price * this.quantity;
        return this.price;
      }
    }

    private Product product;
    /// <summary>
    /// Gets or sets product(stock) for this item.
    /// </summary>
    public Product Product { get { return this.product; } set { this.product = value; } }
    #endregion

    /// <summary>
    /// Default contructor.
    /// </summary>
    public Item()
    {
    }
    /// <summary>
    /// Override ToString() for display purpose.
    /// </summary>
    /// <returns></returns>
    public override string ToString()
    {
      return this.quantity.ToString() + this.unitOfMeasure + " x " + this.product.ToString();
    }
  }
}